<!-- 新增账单 -->
<template>
  <div>
    <bill-info ref="info" :isInfo="true" :options="options"></bill-info>
  </div>
</template>
<script>
  import billInfo from './components/billInfo.vue';
  import { apiPactConstant } from '@a/index';
  import { apiClientList } from '../../api/billManage';

  export default {
    data() {
      return {
        options: {
          clientList: [], //客户
          billTypeNormal: [], //费项非能源费
          billTypeEnergy: [], //费项能源费
          gatherTypeList: [], //收款单类型
        },
      };
    },

    mounted() {
      this.getConstant();
      this.getClientList();
      this.$refs.info.init();
    },

    methods: {
      //常量
      async getConstant() {
        let res = await apiPactConstant();
        this.spaceTypeList = res.spaceType || [];
        this.options.gatherTypeList = res.chargeType || [];
        this.options.billTypeNormal = res.billTypeNormal || [];
        this.options.billTypeEnergy = res.billTypeEnergy || [];
      },

      //选择客户数据源
      async getClientList() {
        let res = await apiClientList();
        this.options.clientList = res.rows || [];
      },
    },

    components: { billInfo },
  };
</script>
<style lang="scss" scoped></style>
